package com.jt.demo7_di;

public class Person {
    private String id; //注入简单的数据
    private String name;
    //private Car car = new Car(); //耦合性高
    private Car car; //spring容器为属性赋值

    public Car getCar() {
        return car;
    }

    public void setCar(Car car) {
        this.car = car;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void sayHi() {
        System.out.println("你好:" + id + ":" + name);
    }

    public void toGo() {
        car.go();
    }
}
